package servlet;

import model.BlogDao;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Title: Delete
 * @Author 郑雨杭
 * @Package servlet
 * @Date 2024/7/31 22:09
 * @description:
 */
@WebServlet("/delete")
public class Delete extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        int id = Integer.parseInt(req.getParameter("blogId"));
        new BlogDao().delete(id);
        resp.sendRedirect(req.getContextPath()+"/blog_list.html");
    }
}
